package com.example.garagemfacil.adapter;

import java.util.ArrayList;
import com.example.garagemfacil.negocio.Saida;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SaidaAdapter extends BaseAdapter {
	private Context context;
	private ArrayList<Saida> lista;

	public SaidaAdapter(Context context,ArrayList<Saida> lista) {
		this.context = context;
		this.lista = lista;
	}

	@Override
	public int getCount() {
		return lista.size();
	}

	@Override
	public Object getItem(int position) {
		return lista.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		Saida saida = lista.get(position);

		if (convertView == null) {
			LayoutInflater inflater = (LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = inflater.inflate(
					com.example.garagemfacil.R.layout.inflate_estacionamento_adapter_saida, null);
		}

		TextView placasaida = (TextView) convertView.findViewById(com.example.garagemfacil.R.id.adapter_placa);
		placasaida.setText(saida.getPlaca());

		TextView modelosaida = (TextView) convertView.findViewById(com.example.garagemfacil.R.id.adapter_modelo);
		modelosaida.setText(saida.getModelo());

		TextView corsaida = (TextView) convertView.findViewById(com.example.garagemfacil.R.id.adapter_cor);
		corsaida.setText(saida.getCorcarro());
		
		TextView valorpago = (TextView) convertView.findViewById(com.example.garagemfacil.R.id.adapter_valor_pago);
		valorpago.setText(saida.getValorpago());
		

		return convertView;

	}

}
